<template>
	<view class="content">
		<!-- <web-view  src="/hybrid/html/index.html"></web-view> -->
		<web-view  :src="url" @message="onMsg"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url : '',
				symbol: undefined
			}
		},
		onLoad(options) {
			this.symbol = options.symbol
      if (this.symbol.indexOf('/') > -1) {
        this.url = `/hybrid/html/index.html?symbol=${options.symbol}&id=${options.id}`
      } else {
        this.url = `/hybrid/html/index2.html?symbol=${options.symbol}&id=${options.id}`
      }
			
		},
		onShow() {
      let title = this.symbol.toUpperCase()
      if (title.indexOf('ETHUSDT') > -1) {
        title = 'ETH/USDT'
      } else if (title.indexOf('BTCUSDT') > -1) {
        title = 'BTC/USDT'
      } else if (title.indexOf('EOSUSDT') > -1) {
        title = 'EOS/USDT'
      }
			uni.setNavigationBarTitle({
			    title: title
			});
		},
		methods: {
      onMsg (e) {
          console.log('webview传参:', e.detail.data)
        if (e.detail.data[0].type) {
          this.$u.route(e.detail.data[0])
        }
      }
		}
	}
</script>

<style>
</style>
